package com.example.JavaWebApi.core.commonmodel.Exceptions;

import com.example.JavaWebApi.core.commonmodel.ResponseTypeEnum;
import lombok.Getter;

/**
 * @program: java-web-api
 * @description: 业务异常类
 * @author: 杨泽
 * @create: 2022-10-10 14:31
 */
@Getter
public class BusinessException extends RuntimeException {
    private ResponseTypeEnum responseTypeEnum;
    private int code;
    private String message;
    public BusinessException (ResponseTypeEnum responseTypeEnum){
        super(responseTypeEnum.getDescription());
        this.code=responseTypeEnum.getCode();
        this.message=responseTypeEnum.getDescription();
        this.responseTypeEnum=responseTypeEnum;
    }
    public BusinessException(ResponseTypeEnum responseTypeEnum,String message){
        super(message);
        this.code=responseTypeEnum.getCode();
        this.message=message;
        this.responseTypeEnum=responseTypeEnum;
    }
}